/*
* 退货详情
* */

import 'package:center_beijing/config/global_config.dart';
import 'package:center_beijing/widgets/imagesWatch_widget2.dart';
import 'package:flutter/material.dart';
import 'package:center_beijing/common/styles.dart';
import 'package:center_beijing/common/utils.dart';
import 'package:get/get.dart';
import 'dart:convert';

class ReturnsDetail extends StatefulWidget {

  @override
  _ReturnsDetailState createState() => _ReturnsDetailState();
}

class _ReturnsDetailState extends State<ReturnsDetail> {
  var currentDetail = json.decode(Get.arguments['operateContentDetail']);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('退货详情'),
      ),
      body: SafeArea(
        child: Container(
          child: SingleChildScrollView(
            child: Column(
              children: [
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Row(
                    children: [
                      Container(
                        padding: EdgeInsets.only(right: Styles.spacing8),
                        child: Text('退货描述',style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                      ),
                      Expanded(child: Container(
                        padding: EdgeInsets.only(right: Styles.spacing8),
                        child: Text(currentDetail['reason'],style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                      ))
                    ],
                  ),
                ),
                currentDetail['attachments'] != null &&
                    currentDetail['attachments']
                        .length >
                        0
                    ? Column(
                  crossAxisAlignment:
                  CrossAxisAlignment
                      .start,
                  children: [
                    Container(
                      padding: EdgeInsets
                          .fromLTRB(
                          Styles.spacing8,
                          Styles
                              .spacing8,
                          Styles
                              .spacing8,
                          Styles
                              .spacing8),
                      child: Text(
                        '图片',
                        style: TextStyle(
                            color: Styles
                                .DetailColor,
                            fontSize: Styles
                                .NormalFont),
                      ),
                    ),
                    ImagesWatchWidget2(
                      photos: currentDetail[
                      'attachments']
                          .map<String>(
                              (image) {
                            return "${GlobalConfig.baseUrl}fs/irest/file/mps_fileTransferHandler/image?id=${image['attachmentId']}&ZJQFSESSION=${GlobalConfig.session}";
                          }).toList(),
                    )
                  ],
                )
                    : Container(),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
